home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / newsgroups / misc.20010921-20020314 / 000145_fdc@watsun.cc.columbia.edu_Sun Nov 11 14:14:08 EST 2001.msg < prev    next >
Text File  |  2020-01-01  |  3KB  |  51 lines

  1. Article: 12965 of comp.protocols.kermit.misc
  2. Path: newsmaster.cc.columbia.edu!watsun.cc.columbia.edu!fdc
  3. From: fdc@watsun.cc.columbia.edu (Frank da Cruz)
  4. Newsgroups: comp.protocols.kermit.misc
  5. Subject: Re: Hex operations in Kermit
  6. Date: 11 Nov 2001 19:14:55 GMT
  7. Organization: Columbia University
  8. Lines: 34
  9. Message-ID: <9sminf$c0h$1@newsmaster.cc.columbia.edu>
  10. References: <I72H7.79555$Gh2.24053794@news2.rdc1.bc.home.com> <XIzH7.83484$Gh2.25452683@news2.rdc1.bc.home.com>
  11. NNTP-Posting-Host: watsun.cc.columbia.edu
  12. X-Trace: newsmaster.cc.columbia.edu 1005506095 12305 128.59.39.2 (11 Nov 2001 19:14:55 GMT)
  13. X-Complaints-To: postmaster@columbia.edu
  14. NNTP-Posting-Date: 11 Nov 2001 19:14:55 GMT
  15. Xref: newsmaster.cc.columbia.edu comp.protocols.kermit.misc:12965
  16.  
  17. In article <XIzH7.83484$Gh2.25452683@news2.rdc1.bc.home.com>,
  18. jens  <psh@home.com> wrote:
  19. : > C-Kermit allows me to send hex code out the serial port with the OUTPUT
  20. : > \xnn command. I am looking for a way to receive hex strings, find a match
  21. : > and do a task based on what hex string was received. I tried doing this
  22. : > with MINPUT and the \xnn notation but Kermit is just splitting it's gut at
  23. : > my feable attempts at this.
  24. : > How would I go about testing for lets say two hex strings \xaa\xab and
  25. : > \x3e\x12 and depending on which string it matches branching to a task
  26. : > list.
  27. : I received lots of help from Frank da Cruz (thanks again !!) and most of my 
  28. : testing for hex characters is working. It seems though that \x00 (nul) is a 
  29. : special case for some reason and testing for it does not succeed. Does 
  30. : anyone know a work-around for this ?
  31. : As an example, my program might receive the following hex string:
  32. : ab 04 cf 69 e8 d5 5c ab 03 93 00 00 bf   
  33. : and based on that needs to send out a reply.
  34. C-Kermit is not called C-Kermit for nothing :-)  It is a burden of C
  35. programs that character strings are terminated by NUL bytes.  To make a
  36. C program "NUL-Clean" requires considerable effort, including foresaking the
  37. use of all library and system calls that take string arguments.  Too bad C
  38. does not include strings as a native data type; if it had done so from the
  39. beginning, we'd probably be landing humans on distant planets by now rather
  40. than futzing with memory leaks, buffer exploits, etc, but I digress.
  41.  
  42. The inability to deal with NUL bytes transparently in INPUT and OUTPUT
  43. commands is a well-documented restriction.  There are ways to get around
  44. it, described in the manual on pages 421-422 but they aren't pretty,
  45. especially on the INPUT side.
  46.  
  47. - Frank
  48.